const Router = require('koa-router');
const { getTaskList, createTask, sortTask, deleteTaskById, updateTaskById, getTaskDetail } = require('../controller/task.controller');
const { idValidator } = require('../middleware');
const { taskValidatorMiddleware, taskSortValidatorMiddleware } = require('../middleware/task.middleware');
const router = new Router();

router.get('/:id', idValidator, getTaskDetail);
router.post('/', getTaskList);//任务列表
router.post('/create', taskValidatorMiddleware, createTask);//新建
router.post('/sort', taskSortValidatorMiddleware, sortTask);//排序
router.post('/del', idValidator, deleteTaskById);
router.post('/edit', idValidator, updateTaskById);

module.exports = router;